<!DOCTYPE html>
<html>
<head>
<head />
<div th:include="base-libs :: base-libs" />
<title>服务包详情</title>
<style type="text/css">
.topBtn{
	float: right;
	margin-right:10px;
	margin-top:5px
}
.td-text{
	width:130px;
}
</style>
</head>
<script th:inline="javascript">
	/**服务项数组*/
	var fwxAry = [[${fwxAry}]];
</script>
<script type="text/javascript">
	$(function() {
		$(this).registerManagerPage({
	        cacheTables: ["TB_ZY_QY_TYPE","TB_ZY_QYDX","TB_ZY_FWBLX"]
	        ,callback: initData
	    });
		initView();
	});
	
	function initView(){
		$("#dgForm").datagrid({
			idField : "FWID",
			uniqueId: "FWID",
			striped : true,
			border:false,
			clickToSelect: true,
			fitColumns: true,
			columns : [[
				{
					field : "FWID",
					width: 150,
					align: "center",
					title : "服务项编号"
				},
				{
					field : "FWMC",
					width: 150,
					align: "center",
					title : "服务项名称"
				},
				{
					field : "FWNR",
					width: 150,
					align: "center",
					title : "服务内容",
					formatter : function(value, row, index){
                        return "<span title='"+value+"'>"+value+"</span>";
                    }
				},
				{
					field : "YLJGMC",
					width: 150,
					align: "center",
					title : "所属机构"
				},
				{
					field : "QYLB",
					width: 100,
					align: "center",
					title : "签约类别",
					formatter:function(value,row){
						var qyType = StoreCache.getCache('TB_ZY_QY_TYPE');
						$.each(qyType.data, function(i,item){
							if(item.XMDM == value){
								value = item.XMMC;
								return false;
							}
						})
						return value;
					}
				},
				{
					field : "FWLBMC",
					width: 100,
					align: "center",
					title : "服务类别"
				},
				{
                    field : "SFBZ",
                    width: 150,
                    align: "center",
                    title : "收费标准",
                    formatter : function(value, row, index){
                        return getSflx(row["SFLX"]) + "," + value + getFydw(row["FYDW"]);
                    }
                },
				{
					field : "FWPC",
					width: 70,
					align: "center",
					title : "服务频次"
				},
				{
					field : "FWZT",
					align: "center",
					width: 60,
					title : "状态",
					formatter : function(value, row, index){
						return getFwbzt(value);
					}
				},
				{
					field : "CJSJ",
					width: 80,
					align: "center",
					title : "创建日期",
					formatter : function(value, row, index){
					    if(!StringUtils.isEmpty(value)){
							value = value.substr(0, 10);
						}
						return value;
					}
				}
			]]
			,pageNumber: 1
			,pageSize: 100
			,fit: true
			,fitColumns: true
			,singleSelect: false
			,rownumbers: true,
			onLoadSuccess:function(data){
// 				alert(JSON.stringify(data))
			}
		});
	}
	
	function initData(cacheData){
		/**加载数据*/
		var fwbCache = StoreCache.removeCache("FWB_INFO");
		if(fwbCache){
			fwbCache["YXQ"] = getYxq(fwbCache["YXQ"]);
			fwbCache["FWBZT"] = getFwbzt(fwbCache["FWBZT"]);
			fwbCache["QYDX"] = getXmmcByXmdm(cacheData["TB_ZY_QYDX"],fwbCache["QYDX"]);
			fwbCache["FWBLX"] = getXmmcByXmdm(cacheData["TB_ZY_FWBLX"],fwbCache["FWBLX"]);
			if(NFTJ_YBFWX){//能否添加医保服务项
				fwbCache["SFBHYBFWX"] = fwbCache["SFBHYBFWX"]==1?"是":"否";
			}else{
			    var $SFBHYBFWX_td = $("#SFBHYBFWX").parent();
                $SFBHYBFWX_td.add($SFBHYBFWX_td.prev()).remove();
                $("#FWBZT").parent().attr("colspan","5");
			}
			$(".table").find(".dataField").each(function(){
			    var key = $(this).attr("id");
			    var val = fwbCache[key];
			    if(key == "CJSJ" && !StringUtils.isEmpty(val)) val = val.substring(0,10);
				$(this).text(val);
			});
			if(fwxAry){
      			$("#dgForm").datagrid("loadData", {"total": fwxAry.length, "rows": fwxAry})
			}
		}
	}
	
	/**返回列表页面*/
	function back(){
		$.QuickUrlUtils.redirectUrl("index.html");
	}
	
	/**获取服务包状态*/
	function getFwbzt(fwbzt){
	    var fwbztObj = {"0":"停用","1":"启用"};
	    return fwbztObj[fwbzt] || fwbzt;
	}
	
	/**获取有效期*/
	function getYxq(yxq){
	    var yxqObj = {"01":"一个月","02":"三个月","03":"半年","04":"一年"};
	    return yxqObj[yxq] || yxq;
	}
	/**获取收费类型*/
	function getSflx(sflx){
	    var sflxObj = {"01":"按次收费","02":"按月收费","03":"按签约周期收费","04":"免费"};
	    return sflxObj[sflx] || sflx;
	}

	/** 值域操作：根据项目代码返回项目名称 */
	function getXmmcByXmdm(cacheArr,XMDM){
		$.each(cacheArr, function(){
		    if(this.XMDM == XMDM){
		        XMDM = this.XMMC;
		        return false;
			}
		})
		return XMDM;
	}

	/**获取收费类型*/
    function getSflx(sflx){
        var sflxObj = {"01":"按次收费","02":"按月收费","03":"按签约周期收费","04":"免费"};
    	return sflxObj[sflx] || sflx;
    }

    /**获取收费单位*/
    function getFydw(fydw){
        var fydwObj = {"01":"元/次","02":"元/月","03":"元"};
    	return fydwObj[fydw] || fydw;
    }
</script>

<body class="easyui-layout">
	<div region="north" style="border: none; overflow: hidden;height:280px;">
		<h4 class="h4-title" style="font-size: 18px;">
			<span>服务包信息</span>
			<button class="btn topBtn" style="float:right" type="button" onclick="back()">返回</button>
		</h4>
		<div class="form-table-box" >
			<table class="table form-table">
				<tr>
					<td class="td-text">服务包编码：</td>
					<td class="td-content">
						<span id="FWBID" class="dataField"></span>
					</td>
					<td class="td-text">服务包名称：</td>
					<td class="td-content">
						<span id="FWBMC" class="dataField"></span>
					</td>
					<td class="td-text">创建时间：</td>
					<td class="td-content">
						<span id="CJSJ" class="dataField"></span>
					</td>
				</tr>
				<tr>
					<td class="td-text">所属机构：</td>
					<td class="td-content">
						<span id="YLJGMC" class="dataField"></span>
					</td>
					<td class="td-text">成本测算价(元)：</td>
					<td class="td-content">
						<span id="CBCSJ" class="dataField"></span>
					</td>
					<td class="td-text">优惠后价格：</td>
					<td class="td-content">
						<span id="FY" class="dataField"></span>
					</td>
				</tr>

				<tr>
					<td class="td-text">签约对象：</td>
					<td class="td-content">
						<span id="QYDX" class="dataField"></span>
					</td>
					<td class="td-text">公卫经费支付费用：</td>
					<td class="td-content">
						<span id="GWJFZF" class="dataField"></span>
					</td>
					<td class="td-text">医保基金支付费用：</td>
					<td class="td-content">
						<span id="YBJJZF" class="dataField"></span>
					</td>
				</tr>
				<tr>
					<td class="td-text">医保个人自付费用：</td>
					<td class="td-content">
						<span id="YBGRZF" class="dataField"></span>
					</td>
					<td class="td-text">居民自费费用：</td>
					<td class="td-content">
						<span id="JMZFFY" class="dataField"></span>
					</td>
					<td class="td-text">服务包类型：</td>
					<td class="td-content">
						<span id="FWBLX" class="dataField"></span>
					</td>
				</tr>
				<tr>
					<td class="td-text">是否包含医保服务项：</td>
					<td class="td-content">
						<span id="SFBHYBFWX" class="dataField"></span>
					</td>
					<td class="td-text">状态：</td>
					<td class="td-content" colspan="3">
						<span id="FWBZT" class="dataField"></span>
					</td>
				</tr>
			</table>
			<h4 class="h4-title" style="font-size: 18px;">
				服务项信息
			</h4>
		</div>
	</div>
	<div region="center" style="border: none;">
			<table id="dgForm">
			</table>
	</div>
</body>
</html>


